package page244;

import java.util.Scanner;

public class Test6 {
    public static void main(String[] args) {
        String s = "数学87分，物理76分，英语96分";
        Scanner scanner = new Scanner(s);
        scanner.useDelimiter("[^0123456789]+");
        int sum = 0;
        while (scanner.hasNext()) {
            try {
                int score = scanner.nextInt();
                sum = sum + score;
            } catch (Exception e) {
                String t = scanner.next();
            }
        }
        System.out.println("sum=" + sum);
        System.out.println("avg=" + sum / 3);

    }
}
